package com.zssj.servise.impl;

import com.zssj.enums.DeletedEnum;
import com.zssj.framework.enums.ErrorCodeEnum;
import com.zssj.framework.model.ErrorCode;
import com.zssj.framework.service.impl.BaseServiceImpl;
import com.zssj.framework.utils.ApiAssert;
import com.zssj.mapper.SysMenuMapper;
import com.zssj.model.dto.MenuDTO;
import com.zssj.model.dto.MenuTreeDTO;
import com.zssj.model.entity.SysMenu;
import com.zssj.servise.ISysMenuService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * @项目名: rzccc_home
 * @描述: 菜单服务类
 * @作者: 杜文骄
 * @时间: 2020-10-03 09:52
 **/
@Service
@AllArgsConstructor
public class SysMenuServiceImpl extends BaseServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {

    @Override
    public void saveMenu(SysMenu menu, List<String> resourceIds) {

    }

    @Override
    public void updateMenu(SysMenu menu, List<String> resourceIds) {

    }

    @Override
    public void removeMenu(Long menuId) {

    }

    @Override
    public MenuDTO getMenuDTODetails(Long menuId) {
        SysMenu menu = getById(menuId);
        ApiAssert.notNull(ErrorCodeEnum.MENU_NOT_FOUND,menu);
        return null;
    }

    @Override
    public List<MenuTreeDTO> getUserPermMenus(Long uid) {
        return null;
    }

    @Override
    public List<MenuTreeDTO> getAllMenuList(Long uid) {
        return null;
    }

    @Override
    public Set<String> getUserPermButtonAliases(Long uid) {
        return null;
    }

    @Override
    public List<String> getUserPermVillage(Long userId) {
        return null;
    }

    /**
     * 获取所有菜单
     * @return
     */
    @Override
    public List<SysMenu> getList() {
        return query().eq(SysMenu::getDeleted, DeletedEnum.UN_DELETED).orderByAsc(SysMenu::getSort).list();
    }
}
